#include <iostream>
using namespace std;


struct Books {
    string title;
    string author;
    string subject;
    int bookId;

    /**
     * 全参构造函数
     * @param title
     * @param author
     * @param subject
     * @param bookId
     */
    Books(string title, string author, string subject, int bookId)
        : title(title), author(author), subject(subject), bookId(bookId) {
        cout << "Books constructor" << endl;
    }

    /**
     * 打印内容
     */
    void printInfo() {
        cout << "title:" << title << " author:" << author << " subject:" << subject << " bookId:" << bookId << endl;
    }
};

void print(Books& books) {
    books.author = "小明";
    books.printInfo();
}

int main(int argc, char *argv[]) {
    Books books = Books("C++入门到熟练", "aike", "C++是一门编程语言", 1);
    print(books);
    books.printInfo();
}
